var motai = document.getElementById('motail');
var moimg = document.getElementById('mo-img');
var realimg = document.getElementsByClassName('real-img');
var motitle = document.getElementById("mo-title")
var mocontent = document.getElementById("mo-content");
var span = document.getElementById("close");


for (let img of realimg) {
  img.addEventListener('click', function (e) {
    motai.style.display = "block";
    moimg.src = this.src;
    motitle.innerHTML = this.alt;
    mocontent.innerHTML = this.title;
  })
}

span.onclick = function () {
  motai.style.display = "none";
}